GBML manual / Tweens

tween_from_to

tween_to with a start of your own: the variable is set to `from` right now, then glides to `to` over `duration` frames. For something that should start from a known place, like a menu that slides in from off the screen.

Works differently on Game Boy - The Game Boy glides up to 8 variables at once (the Advance 16), in 32 steps of the curve, over a distance of less than 1,024; a ninth jumps to its end value as the Advance's does when its places are full.

Works differently on Game Boy Color - The Game Boy Color glides up to 8 variables at once (the Advance 16), in 32 steps of the curve, over a distance of less than 1,024; a ninth jumps to its end value as the Advance's does when its places are full.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

tween_from_to(target, from, to, duration, ease) -> bool

Arguments

NameType
targetfield
fromreal
toreal
durationint
easeeasing

Returns

bool

Description

Like tween_to, but you choose the start. The variable is set to from right away, in the same frame, and then glides to to over duration frames.

Use it when the move should always begin from a known place, such as a menu that slides in from off the screen.

Example

tween_from_to(y, -20, 80, 45, EASE_SINE_OUT);

The instance jumps to y = -20 (above the screen) and glides down to 80 over three quarters of a second, slowing gently as it arrives.

Good to know

On the GBA

Everything tween_to’s page says, with one difference: the variable is set to `from` at once, in the same frame, and the glide starts from there, instead of from wherever the variable happened to be. It answers true when the glide started, false when there was no instance or no free place (then the variable is set to `to`, as for tween_to). A duration of 0 or less just sets the variable to `to`.

See also: Tweenstween_totween_stoptween_runningtween